package com.qf.config;

import com.jagregory.shiro.freemarker.ShiroTags;
import freemarker.template.Configuration;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ShiroFreemarkerConfig implements InitializingBean {

    @Autowired
    private Configuration cfg;

    // 当当前实例初始化成功,并且属性付完值之后,执行.afterPropertiesSet方法
    @Override
    public void afterPropertiesSet() throws Exception {
        cfg.setSharedVariable("shiro",new ShiroTags());
    }
}
